﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RealtyManagementSystem.DAL;

namespace RealtyManagementSystem.BLL
{
    public class BuildingsProvider:IDisposable
    {
        private realtydbEntities _realtyContext = null;

        public BuildingsProvider()
        {
            _realtyContext = new realtydbEntities();
        }

        public IEnumerable<Building> GetBuildings()
        {
            return _realtyContext.Buildings.Take(1000).ToList();
        }


#region Dispose
        private bool disposedValue = false;

        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposedValue)
            {
                if (disposing)
                {
                    _realtyContext.Dispose();
                }
            }
            this.disposedValue = true;
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
#endregion

    }//end class
}
